package com.crm.jdy.service.client;

import com.crm.jdy.common.dto.ClientContractInfoDto;
import com.crm.jdy.common.pojo.ClientContractInfo;
import com.crm.jdy.common.mapper.ClientContractInfoMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**   
 * @Description:(客户合同信息服务实现)
 *
 * @version: V1.0
 * @author: kong
 * 
 */
@Service(version = "${service.version}")
@Component
public class ClientContractInfoServiceImpl  extends ServiceImpl<ClientContractInfoMapper,ClientContractInfo> implements ClientContractInfoService  {

    @Autowired
    ClientContractInfoMapper clientContractInfo;

    @Override
    public PageInfo<ClientContractInfo> seleteContractInfoPageInfo(ClientContractInfoDto clientinfo) {
        PageHelper.startPage( clientinfo.getCurrentPage(),clientinfo.getPageSize());
        List<ClientContractInfo> bookList = clientContractInfo.seleteContractInfo(clientinfo);
        PageInfo<ClientContractInfo> pageInfo = new PageInfo<ClientContractInfo>(bookList);
        return pageInfo;
    }

    @Override
    public boolean updateContractInfo(ClientContractInfo clientinfo) {
        return clientContractInfo.updateById(clientinfo) > 0;
    }

    @Override
    public boolean addContractInfo(ClientContractInfo clientinfo) {
        return clientContractInfo.insert(clientinfo) > 0;
    }

    @Override
    public boolean removeContractInfo(String contractId) {
        return clientContractInfo.deleteById(contractId) > 0;
    }
}